	Element.Properties.shown = {
		get: function(){
			return this.activated;
		},
 
		set: function(value){
			this.activated = !!value;
			this.setAttribute('activated', !!value);
		} 
	};

	var ContentToggler = new Class({
	
		initialize : function(nav,posts){
			this.navs = $$(nav);
			this.posts = $$(posts);
			this.togglers = [];
			
			this.navs.each(function(header,idx){
                                header.addEvent('dblclick',this.toggle.bind(this,idx) ).set('shown',true);
			},this);
			
		},
                
                toggle : function(idx){
			var sel;
			if(document.selection && document.selection.empty){
				document.selection.empty() ;
			} else if(window.getSelection) {
				sel=window.getSelection();
				if(sel && sel.removeAllRanges)  sel.removeAllRanges() ;
			}
                        
                        var nav = this.navs[idx];
                        if(nav.get('shown')){
                                nav.set('shown',false);
                                this.posts[idx].setStyle('display','none');
                        } else {
                                nav.set('shown',true);
                                this.posts[idx].setStyle('display','block');
                        }
                }
		
	});
	
	window.addEvent('domready',function(){
		pt = new ContentToggler('.post-nav', '.storycontent');
	});